# -*- coding: utf-8 -*-
"""
作者: 肖麒
联系方式：QQ：1505448035
时间: 2025/8/4 16:23
文件作用：申请邮箱
"""
import requests


class ApplymailApi:
    def __init__(self):
        pass

    def get_applymail(self, account, mail):
        headers = {
            "Accept": "application/json, text/javascript, */*; q=0.01",
            "Accept-Language": "zh-CN,zh;q=0.9",
            "Cache-Control": "no-cache",
            "Connection": "keep-alive",
            "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
            "Origin": "http://rootsh.com:8003",
            "Pragma": "no-cache",
            "Referer": "http://rootsh.com:8003/",
            "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36",
            "X-Requested-With": "XMLHttpRequest"
        }

        cookies = {
            "mail": mail,
        }

        url = "http://rootsh.com:8003/applymail"
        data = {
            "mail": account
        }
        response = requests.post(url, headers=headers, cookies=cookies, data=data, verify=False)

        return response


if __name__ == '__main__':
    applymail_api = ApplymailApi()
    response = applymail_api.get_applymail()

    res_mail = response.cookies['mail']
    res_time = response.cookies['time']

    json_data = response.json()
    # print('time' + res_time)
    print('mail:' + res_mail)
    print(json_data)
